#ifndef JSON_NODE_HXX
#define JSON_NODE_HXX

#include "Node.h"

namespace codegen
{
    class JsonNode : public Node
    {
    public:
        JsonNode(Type type,
            const resip::Data& key,
            const resip::Data& val,
            const Node* parent,
            Generator* gen)
            : Node(type, key, val, parent, gen)
        {
        }

        bool has_base_class() const;
        const resip::Data& get_base_class() const;
        resip::Data str_type(bool use_alias = false) const;

        EncodeStream& encode_custom_function(EncodeStream& ostm) const;
        EncodeStream& encode_function_pasre(EncodeStream& ostm) const;
        EncodeStream& encode_function_build(EncodeStream& ostm) const;
    };

    class JsonNodeRoot : public JsonNode
    {
    public:
        JsonNodeRoot(Type type,
            const resip::Data& class_name,
            Generator* gen)
            : JsonNode(type, class_name, "", 0, gen)
        {
        }

        resip::Data str_type(bool use_alias = false) const {
            return key_;
        }

        EncodeStream& encode_class_begin(EncodeStream& ostm) const;
        EncodeStream& encode_class_ctor(EncodeStream& ostm) const;
        EncodeStream& encode_custom_function(EncodeStream& ostm) const;
    };
}

#endif // #ifndef JSON_NODE_HXX

